//
//  ChannelPostContent.m
//  __PRODUCTNAME__
//
//  Created by Hanlingyu on 16/09/12
//  Copyright (c) apple. All rights reserved.
//

#import "ChannelPostContent.h"
#import "ChannelPostRanklist.h"
#import "ChannelPostToolbar.h"
#import "ChannelPostHotposts.h"


@implementation ChannelPostContent


- (void)setValue:(id)value forKey:(NSString *)key {
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"toolbar"]) {
        ChannelPostToolbar *toolBar = [ChannelPostToolbar modelWithDic:value];
        _toolbar = toolBar;
    } else if ([key isEqualToString:@"rankList"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            ChannelPostRanklist *rankList = [ChannelPostRanklist modelWithDic:dic];
            [array addObject:rankList];
        }
        _rankList = array;
    } else if ([key isEqualToString:@"hotPosts"]) {
        ChannelPostHotposts *hotPosts = [ChannelPostHotposts modelWithDic:value];
        _hotPosts = hotPosts;
    }
    
}


+ (NSDictionary *)objectClassInArray{
    return @{@"rankList" : [ChannelPostRanklist class]};
}

@end
